﻿Imports System.ComponentModel.DataAnnotations
'Imports System.Data.Spatial

Namespace Solution

    Public Enum eGeometryType
        Marker = 1
        Polyline = 2
        Polygon = 3
        Rectangle = 4
        Circle = 5
        '' agregar mas????
    End Enum

    Public Class MapDataVO

        Private _projectId As Integer

        Private _geometries As New Generic.List(Of MapGeometryVO)
        Private _deletedShapes As New Generic.List(Of Integer)
        'Private _boobleData As BoobleDataVO <<<< VA EN MAPGEOMETRY??

        Public Property projectId As Integer
            Get
                Return _projectId
            End Get
            Set(ByVal value As Integer)
                _projectId = value
            End Set
        End Property
        Public Property geometries As Generic.List(Of MapGeometryVO)
            Get
                Return _geometries
            End Get
            Set(ByVal value As Generic.List(Of MapGeometryVO))
                _geometries = value
            End Set
        End Property
        Public Property deletedShapes As Generic.List(Of Integer)
            Get
                Return _deletedShapes
            End Get
            Set(ByVal value As Generic.List(Of Integer))
                _deletedShapes = value
            End Set
        End Property

    End Class

    Public Class GeoTypeVO
        Inherits BaseVO

        Private _geoTypeId As Integer
        Private _code As String

        Sub New()
        End Sub

        Sub New(entity As Data.BaseModel.GeoType)
            If entity IsNot Nothing Then

                geoTypeId = entity.GeoTypeId
                code = entity.Code
            End If
        End Sub

        Public Property geoTypeId As Integer
            Get
                Return _geoTypeId
            End Get
            Set(value As Integer)
                _geoTypeId = value
            End Set
        End Property
        Public Property code As String
            Get
                Return _code
            End Get
            Set(value As String)
                _code = value
            End Set
        End Property
    End Class

    Public Class BoobleDataVO
        Inherits BaseVO

        Private _boobleDataId As Integer
        Private _content As String

        Sub New()
        End Sub

        Sub New(entity As Data.BaseModel.BoobleData)
            If entity IsNot Nothing Then

                boobleDataId = entity.BoobleDataId
                content = entity.Content
            End If
        End Sub

        Public Property boobleDataId As Integer
            Get
                Return _boobleDataId
            End Get
            Set(value As Integer)
                _boobleDataId = value
            End Set
        End Property
        Public Property content As String
            Get
                Return _content
            End Get
            Set(value As String)
                _content = value
            End Set
        End Property
    End Class

    Public Class MapGeometryVO
        Inherits Models.BaseVO

        Private _geoDataId As Long
        Private _name As String

        Private _geometryId As String
        Private _geometryType As eGeometryType

        '' _points >> para enviar datos al Front
        Private _points As New Generic.List(Of MapPoint)
        '' _pointData >> para traer datos del Front
        Private _pointData As String
        'Private _radius As String '' BORRAR ESTO SINO LO UTILIZO, VER

        '' atributos extras de cada shape
        'Private _attributes As New Generic.List(Of Object)
        Private _attributes As New Generic.List(Of MapAttribute)

        Private _geoType As String '' Marker, Polyline, etc

        Private _hasData As Boolean

        Sub New()
        End Sub

        Public Property pointData() As String
            Get
                Return _pointData
            End Get
            Set(ByVal value As String)
                _pointData = value
            End Set
        End Property
        'Public Property radius As String
        '    Get
        '        Return _radius
        '    End Get
        '    Set(ByVal value As String)
        '        _radius = value
        '    End Set
        'End Property
        Public Property geometryId() As String
            Get
                Return _geometryId
            End Get
            Set(ByVal value As String)
                _geometryId = value
            End Set
        End Property
        Public Property geometryType() As eGeometryType
            Get
                Return _geometryType
            End Get
            Set(ByVal value As eGeometryType)
                _geometryType = value
            End Set
        End Property
        Public Property points() As Generic.List(Of MapPoint)
            Get
                Return _points
            End Get
            Set(ByVal value As Generic.List(Of MapPoint))
                _points = value
            End Set
        End Property
        Public Property dataType() As String
            Get
                Return _geoType
            End Get
            Set(ByVal value As String)
                _geoType = value
            End Set
        End Property
        Public Property entityId() As Long
            Get
                Return _geoDataId
            End Get
            Set(ByVal value As Long)
                _geoDataId = value
            End Set
        End Property
        Public Property name() As String
            Get
                Return _name
            End Get
            Set(ByVal value As String)
                _name = value
            End Set
        End Property
        'Public Property attributes() As Generic.List(Of Object)
        Public Property attributes() As Generic.List(Of MapAttribute)
            Get
                Return _attributes
            End Get
            Set(ByVal value As Generic.List(Of MapAttribute))
                _attributes = value
            End Set
        End Property
        Public Property hasData() As Boolean
            Get
                Return _hasData
            End Get
            Set(ByVal value As Boolean)
                _hasData = value
            End Set
        End Property
    End Class

    ''' <summary>
    ''' Represent an attribute in the geometry (sample: shapefile attribute)
    ''' </summary>
    ''' <remarks></remarks>
    Public Class MapAttribute

        Private _key As String
        Private _value As String
        Private _type As String

        Public Property key() As String
            Get
                Return _key
            End Get
            Set(ByVal value As String)
                _key = value
            End Set
        End Property

        Public Property value() As String
            Get
                Return _value
            End Get
            Set(ByVal value As String)
                _value = value
            End Set
        End Property

        Public Property type() As String
            Get
                Return _type
            End Get
            Set(ByVal value As String)
                _type = value
            End Set
        End Property

    End Class

    ''' <summary>
    ''' Represent a point on map defined by latitude and longitude
    ''' </summary>
    ''' <remarks></remarks>
    Public Class MapPoint

        Private _lat As String
        Private _lng As String

        Sub New()
        End Sub

        Sub New(lat As Double, lng As Double)
            Me.lat = lat
            Me.lng = lng
        End Sub

        Public Property lat() As String
            Get
                Return _lat
            End Get
            Set(ByVal value As String)
                _lat = value
            End Set
        End Property

        Public Property lng() As String
            Get
                Return _lng
            End Get
            Set(ByVal value As String)
                _lng = value
            End Set
        End Property

    End Class

End Namespace